﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;
using ExtBusiness.Admin;
using WF_Business;
using ExtBusiness.FlowOperation;

public partial class Xnjc_department_form : PageBase
{
    public string wname = string.Empty;
    public string orderBy = string.Empty;
    public string timeFromOfAccept = string.Empty;
    public string timeToOfAccept = string.Empty;
    public string orderID = string.Empty;
    public string userid = string.Empty;
    public ArrayList alWorkStatus = null;
    public string strDepartName = string.Empty;
    public System.Data.DataTable dtWorkFlowNames;
    protected string strhtml = string.Empty;

    protected void Page_Load(object sender, EventArgs e)
    {
         wname = Request["wname"];
         orderBy = Request["orderBy"];
         timeFromOfAccept = Request["timeFromOfAccept"];
         timeToOfAccept = Request["timeToOfAccept"];
         orderID = Request["orderID"];

         userid = UserId;

        //判断当前登录用户是否为系统管理员
         bool ISsystemUser = SystemManager.IsSystemUser(userid);

        if (String.IsNullOrEmpty(orderBy))
            orderBy = "hist.step";
        ClsWorkFlow clsWorkFlow = new ClsWorkFlow();


        if (!string.IsNullOrEmpty(wname) && !string.IsNullOrEmpty(orderID))
        {
            alWorkStatus = clsWorkFlow.WorkStatusOfStepAndDepartment(wname, orderID, timeFromOfAccept,
                timeToOfAccept, orderBy);

            ExtBusiness.Admin.Department depart = new ExtBusiness.Admin.Department();
            strDepartName = depart.GetDepartmentById(orderID);
        }

        if (!ISsystemUser)
        {
            string strSql = "select t.task  from xt_query_right t  where t.userid = '" + userid + "'";
            SysParams.OAConnection().RunSql(strSql, out dtWorkFlowNames);
        }
        else
        {
            //获取业务名称
            dtWorkFlowNames = clsWorkFlow.GetFlowName();
        }

        foreach (System.Data.DataRow drName in dtWorkFlowNames.Rows)
        {
            string strOption = string.Format("<option value='{0}'>{0}</option>", drName[0]);
            strhtml+=strOption;
        }
    
    }
}
